package com.mengniu.commerce.sync.common.utils;

import com.mengniu.commerce.common.core.utils.IdGeneratorSnowflake;
import com.mengniu.commerce.sync.mapper.MnApiLogMapper;
import com.mengniu.commerce.sync.model.MnApiLogModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

@Slf4j
@Component
public class InsertMnApiLogModelUtil {

    @Resource
    private MnApiLogMapper mnApiLogMapper;

    public void insert(String mnRequest,String mnResponse,String mnApiUrl,String massage,String requestId){
        MnApiLogModel mnApiLogModel = new MnApiLogModel();
        mnApiLogModel.setId(new IdGeneratorSnowflake().snowflakeId());
        mnApiLogModel.setMnRequest(mnRequest);
        mnApiLogModel.setMnResponse(mnResponse);
        mnApiLogModel.setMnApiUrl(mnApiUrl);
        mnApiLogModel.setMassage(massage);
        mnApiLogModel.setRequestId(requestId);
        mnApiLogModel.setCreateTime(new Date());
        mnApiLogMapper.insertMnApiLog(mnApiLogModel);
    }

}
